home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Internet Info 1994 March
/
Internet Info CD-ROM (Walnut Creek) (March 1994).iso
/
networking
/
ip
/
ka9q
/
xobbs.arc
/
xomisc.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-05-03
|
2KB
|
104 lines
/* XOMISC.C miscellaneous routines for W2XO bbs Jim Durham, W2XO 10-24-88 */
/* Version 1.0 */
/* Code released to the amateur radio community*/
#include "xobbs.h"
fldmatch(arg,fld) /*match a field with an argument*/
char *arg, *fld;
{
register int i;
for(i=0;i<6;i++)
{
if(arg[i] != fld[i])
{
if(arg[i] == '\0')
return(1);
else
return(0);
}
}
return(1);
}
indexn(s,t,n)
char s[],t[];
int n;
{
int i,j,k;
for(i=0;s[i]!= '\0'; i++){
for(j=i,k=0;(t[k]!='\0' && s[j] == t[k]) && (j < n); j++,k++)
;
if(t[k] == '\0')
return(i);
}
return(-1);
}
indexx(s,t)
char s[],t[];
{
int i,j,k;
for(i=0;s[i]!= '\0'; i++){
for(j=i,k=0;t[k]!='\0' && s[j] == t[k]; j++,k++)
;
if(t[k] == '\0')
return(i);
}
return(-1);
}
stringcpy(s,t,n)
char *s,*t;
int n;
{
int i;
i=0;
while((t[i] != ' ') && (i < n)){
s[i]=t[i];
i++;
}
s[i]='\0';
}
sendnames()
{
static char bbsnam[15][7];
int i,j,x,flag,ic;
FILE *fp;
char s[30];
sprintf(prinbuf,"ls %s",fwddir); /*popen the forwarding directory*/
fp=popen(prinbuf,"r");
x=0; /*count of places to forward*/
for(;;){
i=0;
while(((ic = getc(fp)) != '\n') && (ic != EOF)) /*read fwd file*/
s[i++] = ic & 0x7f;
if(ic == EOF) break; /*break loop if EOF*/
s[i] = '\0'; /*terminate filename*/
for(j=0;j < strlen(s);j++) /*terminate the bbsname with \0 */
if(s[j] == 't'){
s[j]='\0';
break;
}
flag=0;
for(j=0;j<15;j++) /*sort out the bbs names*/
if(!strcmp(bbsnam[j],s))
flag=1;
if(flag == 0) strcpy(bbsnam[x++],s); /*fill the name array*/
/*now , we have the unique bbs names in an array*/
}/* for(;;) */
x=0;
while(bbsnam[x][0] != '\0') /*print out the names*/
sprintf(prinbuf,"%s\n",bbsnam[x++]);
prinout();
sndupkil();
}